<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>大事件-后台登录页</title>
    <link rel="stylesheet" type="text/css" href="css/reset.css" />
    <link rel="stylesheet" type="text/css" href="css/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="css/main.css" />
    <!-- 引入bootstrap的css文件 -->
    <link rel="stylesheet" href="./libs/bootstrap/css/bootstrap.min.css" />
    <!-- 引入jq文件 -->
    <script src="./libs/jquery-1.12.4.min.js"></script>
    <!-- 引入bootstrap的js文件 -->
    <script src="./libs/bootstrap/js/bootstrap.min.js"></script>
    <script src="./libs/http.js"></script>
</head>

<body>
    <div class="main_wrap">
        <div class="header">
            <a href="#" class="logo"><img src="images/logo.png" alt="" /></a>
            <div class="copyright">
                CopyRight © 2019 深圳百秀信息技术股份有限公司<br />All Rights Reserved
            </div>
        </div>

        <div class="login_form_con">
            <div class="login_title"></div>
            <form class="login_form">
                <i class="iconfont icon-user"></i>
                <i class="iconfont icon-key"></i>
                <input type="text" class="input_txt" placeholder="邮箱/手机号" />
                <input type="password" class="input_pass" placeholder="密码" />
                <input type="submit" class="input_sub" value="登 录" />
            </form>
        </div>
    </div>
    <!-- bootstrap模态框 -->
    <div class="modal fade" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">Modal title</h4>
                </div>
                <div class="modal-body">
                    <p>One fine body&hellip;</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary">Save changes</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    <script>
        //入口函数
        window.onload = () => {
            // 2.获取登录标签元素
            document.querySelector('.input_sub').onclick = (e) => {
                //阻止submit跳转
                e.preventDefault();
                //获取输入框的支，并清除左右空格
                const username = document.querySelector('.input_txt').value.trim();
                const password = document.querySelector('.input_pass').value.trim();
                //判断用户是否未输入内容
                if (username == '' || password == '') {
                    alert('请您输入账号和密码！');
                    return;
                };
                let xhr = new XMLHttpRequest();
                xhr.open('post', BigNew.user_login);
                // xhr.setRequestHeader('Authorization', localStorage.getItem('bignews'));
                xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                xhr.onload = () => {
                    console.log(xhr.response);
                    // console.log(backData);
                    // if (xhr.re) {
                    //     alert('登录成功！');
                    //     window.location.href = './index.html';
                    //     localStorage.setItem('bignews', backData.token);
                    // } else {
                    //     alert('账户或密码错误！');
                    // }

                }
                xhr.send('username');


            }


        }
    </script>
</body>

</html>